﻿using System;
using System.Threading.Tasks;

namespace Sidvall.SystemEnvironment.Uwp
{
    public class Package : IPackage
    {
        #region Public Members

        #region GetInstalledDateAsync

        public Task<DateTime> GetInstalledDateAsync()
        {
            return Task.FromResult(Windows.ApplicationModel.Package.Current.InstalledDate.UtcDateTime);
        }

        #endregion
        #region GetVersionAsync

        public Task<string> GetVersionAsync()
        {
            var version = Windows.ApplicationModel.Package.Current.Id.Version;
            var value = string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
            return Task.FromResult(value);
        }

        #endregion

        #region ToString

        public override string ToString()
        {
            return "Package - UWP";
        }

        #endregion

        #endregion
    }
}
